import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-11-11
 * Time: 15:24
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        double[] weights = new double[N];
        for (int i = 0; i < N; i++) {
            weights[i] = scanner.nextDouble();
        }
        Arrays.sort(weights); // 对鸡蛋重量进行排序

        double minDifference = Double.MAX_VALUE;
        double maxWeight = 0;

        // 遍历所有可能的M个连续鸡蛋的组合
        for (int i = 0; i <= N - M; i++) {
            double currentWeight = 0;
            double max = weights[i];
            double min = weights[i + M - 1];
            for (int j = i; j < i + M; j++) {
                currentWeight += weights[j];
            }
            double currentDifference = max - min;
            // 如果当前组合的重量差距更小，更新最小重量差距和最大重量
            if (currentDifference < minDifference) {
                minDifference = currentDifference;
                maxWeight = currentWeight;
            }
        }

        // 输出符合条件的最重一盒鸡蛋的总重量，保留两位小数
        System.out.printf("%.2f\n", maxWeight);
    }
    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(); //鸡蛋总数
        int M = sc.nextInt(); //每盒个数
        double[] weights = new double[N];
        for (int i = 0; i < N; i++) {
            weights[i] = sc.nextDouble();
        }
        Arrays.sort(weights);

        double minDifference = Double.MAX_VALUE;
        double maxWeight = 0;

        for (int i = 0; i < N - M; i++) {
            double currentWeight = 0;
            double max = weights[i];

        }
    }

    public static void main4(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= N; i++) {
            int cube = i*i*i;
            int sqrt = (int) Math.sqrt(cube);

            //检查x的立方根是否为整数
            if(sqrt* sqrt == cube){
                System.out.print(i + " ");
            }
        }
    }



    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i <= N; i++) {
            int count = 0;
            for (int j = 1; j <= i; j++) {
                if(i % j == 0){
                    count++;
                }
            }
            if(count >= 4){
                System.out.print(i + " ");
            }
        }
    }


    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;

        for (int i = 2; i <= N; i++) {
            int divisorCount = 0;
            for (int j = 1; j <= N; j++) {
                if(i % j == 0){
                   divisorCount++;
                }
            }
            if(divisorCount > 2){
                count++;
            }
        }
        System.out.println(count);
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();

        int count = 0;
        for (int i = 1; i <= N; i++) {
            if(i % A == A-1 && i % 2 == 0){
                count++;
            }
        }
        System.out.println(count);
    }
}
